package com.cesc.demo.interfaces.assembler;

import com.cesc.demo.interfaces.dto.ResponseResult;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;

@Component
public class ResponseResultFactory<Do> {

    public ResponseEntity<ResponseResult<Do>> build(Do data, Integer code, String message){
        ResponseResult<Do> responseResult=new ResponseResult<>();
        responseResult.setCode(code);
        responseResult.setDate(data);
        responseResult.setMesasge(message);
        return ResponseEntity.status(code).body(responseResult);

    }
}
